<html>
  <body onbeforeunload="return runBeforeUnload()">
    <p>Some text so the document is ready for input.</p>
  </body>
  <script>
    function runBeforeUnload() {
      return "foo";
    }
  </script>
</html>
